import * as Z from './common.js';
import { go, goBack } from '@/router/index.js';
import { ElMessage } from 'element-plus';
import { invoke } from "./utils/invoke.js"
import { post, startPost,endPost,get,endGet,request,getFileStr,downLoad,postFormData } from './utils/network.js';
import { $zConfirm } from '@/components/index.js';
// 全局注册公共函数
window._ = {
  // 公共函数函数
  ...Z,
  // electron请求
  invoke,
  // 网络请求
  post,
  startPost,
  endPost,
  get,
  endGet,
  request,
  getFileStr,
  downLoad,
  postFormData,
  // 路由跳转
  go,
  goBack,
  // 打印信息
  message: {
    success: (val) => ElMessage({ message: val, grouping: true, type: 'success' }),
    warning: (val) => ElMessage({ message: val, grouping: true, type: 'warning' }),
    error: (val) => ElMessage({ message: val, grouping: true, type: 'error' }),
  },
  // 二次确认组件，命令式调用
  $zConfirm,
};
